'''
添加日程
'''

from selenium.webdriver.common.by import By
from page.base_page import BasePage

class Tianjianricheng(BasePage):
    url = 'http://192.168.1.25/crm/index.php?m=task&a=add'

    # 输入主题
    zhuti_locator = (By.ID, 'subject')
    # 点击负责人
    fzr_locator = (By.ID, 'owner_name')
    # 选择负责人
    xzfzr_locator = (By.CSS_SELECTOR, '#ta1 > input')
    # 点击确定
    dianjiok_locator = (By.XPATH, '/html/body/div[7]/div[3]/div/button[1]')
    # 选择相关
    xzxg_locator = (By.CSS_SELECTOR, '#select1')
    # 选择联系人
    xzlxr_locator = (By.CSS_SELECTOR, '#select1 > option:nth-child(2)')
    # 勾选
    gx_locator = (By.CSS_SELECTOR, '#data2 > tr > td:nth-child(1) > input[type=radio]')
    # 点击ok
    dianji_locator = (By.XPATH, '/html/body/div[9]/div[3]/div/button[1]')
    # 输入内容
    srnr_locator = (By.CSS_SELECTOR, '#module_name')
    # 点击保存
    baocun_locator = (By.CSS_SELECTOR,
                      'body > div.container > div.row-fluid > div > form > table > tfoot > tr > td:nth-child(2) > input:nth-child(1)')

    def zhuti(self,shu):
        self.driver.find_element(*self.zhuti_locator).send_keys(shu)

    def fzr(self):
        self.driver.find_element(*self.fzr_locator).click()

    def xzfzr(self):
        self.driver.find_element(*self.xzfzr_locator).click()

    def queding(self):
        self.driver.find_element(*self.dianjiok_locator).click()

    def xiangguan(self):
        self.driver.find_element(*self.xzxg_locator).click()

    def xzlxr(self):
        self.driver.find_element(*self.xzlxr_locator).click()

    def gx(self):
        self.driver.find_element(*self.gx_locator).click()

    def dianjiok(self):
        self.driver.find_element(*self.dianji_locator).click()

    def srnr(self,shuru):
        self.driver.find_element(*self.srnr_locator).send_keys(shuru)

    def djbc(self):
        self.driver.find_element(*self.baocun_locator).click()

